package com.bawei.wyg.mycommerce.homework.one;

import androidx.appcompat.app.AppCompatActivity;
import androidx.databinding.DataBindingUtil;

import android.os.Bundle;
import android.widget.Toast;

import com.bawei.wyg.mycommerce.R;
import com.bawei.wyg.mycommerce.databinding.ActivityHomeWorkBinding;
import com.bawei.wyg.mycommerce.databinding.bind.BindActivity;
import com.bawei.wyg.mycommerce.databinding.single.SingleActivity;

public class HomeWorkActivity extends AppCompatActivity {
    ActivityHomeWorkBinding binding;
    int num=0;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        binding= DataBindingUtil.setContentView(this,R.layout.activity_home_work);
        binding.setSingleClick(new SingleClick());
        binding.setHomework(num+"");
    }
    public class SingleClick{
        public void btnClickjia(){
            num++;
            binding.setHomework(num+"");
            Toast.makeText(HomeWorkActivity.this, "点击了加", Toast.LENGTH_SHORT).show();
        }
        public void btnClickjian(){
            if(num==0){
                Toast.makeText(HomeWorkActivity.this, "已经到0了yoooo~~", Toast.LENGTH_SHORT).show();
            }else{
                num--;
                binding.setHomework(num+"");
            }

            Toast.makeText(HomeWorkActivity.this, "点击了减", Toast.LENGTH_SHORT).show();
        }
    }
}